
** RobertstonTeitelbaumAJPS
use Robertson_TeitelbaumAJPS, clear

sort ccode year
merge m:1 ccode using cites.dta 
drop if _m==2 
drop _merge
gen cites = year>=citesyr

tsset country year 

gen study = ""
foreach n in orig noth fe time fet ct yfe cyfe {
gen method_`n' = ""
gen dv_`n' = ""
gen b_cites_`n' = .
gen se_cites_`n'= .
gen pval_cites_`n' = .
gen lo_cites_`n'=.
gen hi_cites_`n'=.
gen N_cites_`n'=.
}
gen studynum=.
gen timetrend=""
qui do cites.do
local ii = 1

* model 1
xtnbreg dispute cites L.l_flows L.polity2 L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time, re
cites `ii' orig
xtnbreg dispute cites L.l_flows L.polity2 L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop , re
cites `ii' noth
xtnbreg dispute cites L.l_flows L.polity2 open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop , fe
cites `ii' fe
xtnbreg dispute cites L.l_flows L.polity2 L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time, re
cites `ii' time
xtnbreg dispute cites L.l_flows L.polity2 open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time , fe
cites `ii' fet
nbreg dispute cites L.l_flows L.polity2 /* L.dispute*/ open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.ccode#c.time if e(sample), vce(cl ccode)
cites `ii' ct
xtnbreg dispute cites L.l_flows L.polity2 open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.year, re
cites `ii' yfe
xtnbreg dispute cites L.l_flows L.polity2 open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.year , fe
cites `ii' cyfe
replace studynum = `ii' if _n==`ii'   
replace timetrend = "year" if _n==`ii'   
local ii=`ii'+1
* model 2
xtnbreg dispute cites L.l_flows L.polity2 L.demflows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time, re
cites `ii' orig
xtnbreg dispute cites L.l_flows L.polity2 L.demflows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop , re
cites `ii' noth
xtnbreg dispute cites L.l_flows L.polity2 L.demflows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop , fe
cites `ii' fe
xtnbreg dispute cites L.l_flows L.polity2 L.demflows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time, re
cites `ii' time
xtnbreg dispute cites L.l_flows L.polity2 L.demflows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time , fe
cites `ii' fet
nbreg dispute cites L.l_flows L.polity2 L.demflows /*L.dispute*/ open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.ccode#c.time if e(sample), vce(cl ccode)
cites `ii' ct
xtnbreg dispute cites L.l_flows L.polity2 L.demflows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop  i.year, re
cites `ii' yfe
xtnbreg dispute cites L.l_flows L.polity2 L.demflows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.year , fe
cites `ii' cyfe
replace timetrend = "year" if _n==`ii'   
replace studynum = `ii' if _n==`ii'   
local ii=`ii'+1
* model 3
xtnbreg dispute cites L.l_flows L.fh_cl_inv L.fh_cl_inv_flows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time, re
cites `ii' orig
xtnbreg dispute cites L.l_flows L.fh_cl_inv L.fh_cl_inv_flows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop , re
cites `ii' noth
xtnbreg dispute cites L.l_flows L.fh_cl_inv L.fh_cl_inv_flows  open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop , fe
cites `ii' fe
xtnbreg dispute cites L.l_flows L.fh_cl_inv L.fh_cl_inv_flows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time, re
cites `ii' time
xtnbreg dispute cites L.l_flows L.fh_cl_inv L.fh_cl_inv_flows  open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time , fe
cites `ii' fet
nbreg dispute cites L.l_flows L.fh_cl_inv L.fh_cl_inv_flows /*L.dispute*/ open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.ccode#c.time if e(sample), vce(cl ccode)
cites `ii' ct
xtnbreg dispute cites L.l_flows L.fh_cl_inv L.fh_cl_inv_flows  open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop  i.year, re
cites `ii' yfe
xtnbreg dispute cites L.l_flows L.fh_cl_inv L.fh_cl_inv_flows  open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.year, fe
cites `ii' cyfe
replace timetrend = "year" if _n==`ii'   
replace studynum = `ii' if _n==`ii'   
local ii=`ii'+1
* model 4
xtnbreg dispute cites L.l_flows L.polcomp L.polcomp_flows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time, re
cites `ii' orig
xtnbreg dispute cites L.l_flows L.polcomp L.polcomp_flows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop , re
cites `ii' noth
xtnbreg dispute cites L.l_flows L.polcomp L.polcomp_flows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop , fe
cites `ii' fe
xtnbreg dispute cites L.l_flows L.polcomp L.polcomp_flows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time, re
cites `ii' time
xtnbreg dispute cites L.l_flows L.polcomp L.polcomp_flows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time , fe
cites `ii' fet
nbreg dispute cites L.l_flows L.polcomp L.polcomp_flows /*L.dispute*/ open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.ccode#c.time if e(sample), vce(cl ccode)
cites `ii' ct
xtnbreg dispute cites L.l_flows L.polcomp L.polcomp_flows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop  i.year, re
cites `ii' yfe
xtnbreg dispute cites L.l_flows L.polcomp L.polcomp_flows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.year , fe
cites `ii' cyfe
replace timetrend = "year" if _n==`ii'   
replace studynum = `ii' if _n==`ii'   
local ii=`ii'+1
* model 5
xtnbreg dispute cites L.l_flows L.sFArights L.sFArights_flows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time, re
cites `ii' orig
xtnbreg dispute cites L.l_flows L.sFArights L.sFArights_flows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop , re
cites `ii' noth
xtnbreg dispute cites L.l_flows L.sFArights L.sFArights_flows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop , fe
cites `ii' fe
xtnbreg dispute cites L.l_flows L.sFArights L.sFArights_flows L.dispute open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time, re
cites `ii' time
xtnbreg dispute cites L.l_flows L.sFArights L.sFArights_flows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop time , fe
cites `ii' fet
nbreg dispute cites L.l_flows L.sFArights L.sFArights_flows /*L.dispute*/ open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.ccode#c.time if e(sample), vce(cl ccode)
cites `ii' ct
xtnbreg dispute cites L.l_flows L.sFArights L.sFArights_flows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop  i.year, re
cites `ii' yfe
xtnbreg dispute cites L.l_flows L.sFArights L.sFArights_flows open_penn l_gdp_pc_penn gdp_grth inflation_1 urban xratchg l_pop i.year, fe
cites `ii' cyfe
replace timetrend = "year" if _n==`ii'   
replace studynum = `ii' if _n==`ii'   
local ii=`ii'+1
replace study = "Robertston Teitelbaum" if studynum~=. 	

keep study-timetrend
drop if studynum==.
compress
save robertstonteitelbaum.dta , replace
